<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>直线</title>
</head>
<body>

<canvas id="canvas" style="border:1px solid #aaa; display:block; margin:50px auto;">
	当前浏览器不支持canvas, 请更换浏览器后再试
</canvas>
<script>
	window.onload = function(){
		var canvas = document.getElementById("canvas");
		
		canvas.width = 500;
		canvas.height = 500;
		
		var context = canvas.getContext("2d");
		
		context.moveTo( 100, 100);
		context.lineTo( 300, 300);
		context.lineWidth = 10;
		context.strokeStyle = "red";
		context.stroke();	
	}
</script>
</body>
</html>
